import React from 'react';

export class App extends React.Component {
  // 定义事件处理函数
  clickHandler(e) {
    console.log('按钮2', e);
  }

  render() {
    return (
      <div>
        <h2>类组件事件绑定</h2>
        <button onClick={() => console.log('按钮1')}>按钮1</button>
        <button onClick={this.clickHandler}>按钮2</button>
      </div>
    );
  }
}
